<?php
//ob_start('ob_gzhandler');
require_once 'Environment.php';
if (Environment::isDevelopment())
    defined('YII_DEBUG') or define('YII_DEBUG', true);

defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL', 1);  //enable logging call stack information	
require_once(dirname(__FILE__) . '/../framework/yii.php'); // include Yii bootstrap file

$configFile = 'protected/config/main.' . YII_ENVIRONMENT . '.php';
//Yii::createWebApplication($configFile)->run();    // create a Web application instance and run
//ob_flush();

$app = Yii::createWebApplication($configFile);
Yii::app()->onBeginRequest = function($event) {
    return ob_start('ob_gzhandler');
};

Yii::app()->onEndRequest = function($event) {
    return ob_end_flush();
};
$app->run();
